package com.itdachang.design.structural.adapter.clazz;

import com.itdachang.design.structural.adapter.Player;
import com.itdachang.design.structural.adapter.Zh_JPTranslator;

/**
 * 继承的方式：类结构模型，适配转换到了翻译器的功能上
 * @author gcq
 * @Create 2022-02-09
 */
public class JPMoviePlayerAdapter extends Zh_JPTranslator implements Player {

    /**
     * 被适配对象
     */
    private Player target;
    public JPMoviePlayerAdapter(Player target) {
        this.target = target;
    }
    @Override
    public String player() {
        String player = target.player();

        // 转换字幕
        String translate = translate(player);
        System.out.println("日文：" + translate);
        return translate;
    }
}
